package zouze.contrlloer;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Servlet implementation class LoginServlet
 */
public class LoginServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
    
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		String name=request.getParameter("userName");
		String pwd=request.getParameter("passWord");
		
		if(name.equals("张三")&&pwd.equals("123")){
			HttpSession session = request.getSession();
			session.setAttribute("name", name);
			session.setAttribute("pwd", pwd);
			request.getRequestDispatcher("zouze/shouye.jsp").forward(request, response);
		}else{
			request.getRequestDispatcher("zouze/login.jsp").forward(request, response);
		}
	}

}
